package model

import (
	"team-evaluate/pkg/app"
)

type Team struct {
	*Model
	Name   string `gorm:"not null" json:"name"`
	IsFull bool   `gorm:"default:false" json:"is_full"`
	Desc   string `json:"desc"`
}

type TeamRes struct {
	ID         uint32 `gorm:"id" json:"id"`
	Name       string `gorm:"name" json:"name"`
	IsFull     bool   `gorm:"is_full" json:"is_full"`
	Desc       string `gorm:"desc" json:"desc"`
	CreatedOn  uint64 `gorm:"created_on" json:"created_on"`
	ModifiedOn uint64 `gorm:"modified_on" json:"modified_on"`
	CreatedBy  uint32 `gorm:"created_by" json:"created_by"`
	UserCount  int    `gorm:"user_count" json:"user_count"`
}

type DeleteUserRequest struct {
	ID uint32 `form:"id" binding:"required,gte=1"`
}

type TeamPager struct {
	List  []*Team
	Pager *app.Pager
}

func (Team) TableName() string {
	return "team"
}

type ListTeamRequest struct {
	CreatedBy uint32    `form:"created_by" binding:"required,gte=1" json:"created_by"`
	Pager     app.Pager `form:"pager" json:"pager"`
}

type CreateTeamRequest struct {
	Name      string `form:"name" binding:"required" json:"name"`
	CreatedBy uint32 `form:"created_by" binding:"required,gte=1" json:"created_by"`
	Desc      string `form:"desc" binding:"omitempty,max=100" json:"desc"`
}

type UpdateTeamRequest struct {
	ID        uint32 `form:"id" binding:"required,gte=1"`
	Name      string `form:"name" json:"name"`
	Desc      string `form:"desc" binding:"omitempty,max=100" json:"desc"`
	CreatedBy uint32 `form:"created_by" binding:"required,gte=1" json:"created_by"`
}

type DeleteTeamRequest struct {
	ID uint32 `form:"id" binding:"required,gte=1"`
}

type FindByIdTeamRequest struct {
	ID uint32 `form:"id" binding:"required,gte=1"`
}

type FindByNameTeamRequest struct {
	Name      string `form:"name" binding:"required"`
	CreatedBy uint32 `form:"created_by" binding:"required,gte=1" json:"created_by"`
}
